package com.da.controller;


import com.da.productPojo.Product;
import com.da.service.ProductService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 商品控制器
 *
 * @Author chen
 * @Date 2025/8/6 17:30
 */
@Slf4j
@RestController
@RequiredArgsConstructor
public class ProductController {
    //注入商品服务
    private final ProductService productService;
    /**
     * 根据商品id查询商品信息
     * @param productId
     * @return
     */
    @GetMapping("/getProductById/{productId}")
    public Product getProductById(@PathVariable("productId") Long productId) {
        log.info("查询商品id为{}", productId);
        return productService.getProductById(productId);
    }
}
